<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>


    function calc(m, n) { // 2 5
        let arr = []

        for (let i = 0; i < m; i++) {
            arr[i] = []
            for (let j = 0; j < n; j++) {
                arr[i][j] = 1
            }
        }

        for (let i = 1; i < m; i++) {
            for (let j = 1; j < n; j++) {
                arr[i][j] = arr[i - 1][j] + arr[i][j - 1]
            }
        }
        return arr[m - 1][n - 1]

    }

    console.log(calc(2,5))
</script>
</body>
</html>